package com.dubbo.snail;

import com.alibaba.nacos.spring.context.annotation.config.NacosPropertySource;
import com.alibaba.nacos.spring.context.annotation.config.NacosPropertySources;
import com.dubbo.myRule.MySelfRule;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
import org.springframework.cloud.netflix.ribbon.RibbonClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext;

import java.util.concurrent.TimeUnit;

/**
 * @Description TODO
 * @Author xueguoping
 * @Date 2021/5/8 10:20
 */
//@RibbonClient(name = "spring-cloud-nacos-sample",configuration = MySelfRule.class)
@SpringBootApplication
/*@NacosPropertySources({
		@NacosPropertySource(dataId = "prod.yaml",groupId = "PROD_GROUP",autoRefreshed = true),
		@NacosPropertySource(dataId = "test.yaml",groupId = "TEST_GROUP",autoRefreshed = true)
})*/
@EnableFeignClients({"com.dubbo.snail.httpService"})
//@EnableCircuitBreaker
@EnableHystrix
public class NacosConsumerApplication {
	public static void main(String[] args) {

		SpringApplication.run(NacosConsumerApplication.class, args);
		/*ConfigurableApplicationContext run = SpringApplication.run(NacosConsumerApplication.class, args);
		while (true){
			String info = run.getEnvironment().getProperty("info");
			System.out.println(info);
			try {
				TimeUnit.SECONDS.sleep(2);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}*/
	}
}
